@extends('base.base')
@section('base')
    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="page-header">
                <h3 class="page-title">
                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
                        <i class="mdi mdi-settings"></i>
                    </span>
                    口子
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="/admin/app/list">应用管理</a></li>
                        <li class="breadcrumb-item active" aria-current="page">结果列表</li>
                    </ol>
                </nav>
            </div>
            <div class="row">
                <div class="col-lg-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="card-title">结果列表</h4>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>序号</th>
                                    <th>推广链接</th>
                                    <th>应用名称</th>
                                    <th>收录时间</th>
                                    <th>口子地址</th>
                                    <th>口子名称</th>
                                    <th>口子类型</th>
                                </tr>
                                </thead>
                                <tbody>
                                @if(!empty($list))
                                    @foreach($list as $k => $v)
                                        <tr>
                                            <td>{{++$k}}</td>
                                            <td>{{ $v['app_link'] }}</td>
                                            <td>
                                                {{ $v['app_name'] }}
                                            </td>
                                            <td>
                                                {{ date("Y-m-d H:i:s", intval($v['insert_at'])) }}
                                            </td>
                                            <td>
                                                {{$v['kouzi_link']}}
                                            </td>
                                            <td>
                                                {{$v['kouzi_name']}}
                                            </td>
                                            <td>
                                                {{$v['kouzi_type']}}
                                            </td>
                                        </tr>
                                    @endforeach
                                @endif
                                </tbody>
                            </table>
                            <div class="box-footer clearfix">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(function(){
            cutStr(50);
        });
        function add(){
            var page = layer.open({
                type: 2,
                title: '添加应用',
                shadeClose: true,
                shade: 0.8,
                area: ['70%', '90%'],
                content: '/admin/app/add'
            });
        }
        function update(id){
            var page = layer.open({
                type: 2,
                title: '修改应用',
                shadeClose: true,
                shade: 0.8,
                area: ['70%', '90%'],
                content: '/admin/app/update/'+id
            });
        }
        function del(id){
            myConfirm("删除操作不可逆,是否继续?",function(){
                myRequest("/admin/app/del/"+id,"post",{},function(res){
                    layer.msg(res.msg)
                    setTimeout(function(){
                        window.location.reload();
                    },1500)
                });
            });
        }

        $('.menu-switch').click(function(){
            id = $(this).attr('id');
            state = $(this).attr('state');
            console.log(id)
            console.log(state)
            if(state == "on"){
                $('.pid-'+id).hide();
                $(this).attr("state","off")
                $(this).removeClass('mdi-menu-down').addClass('mdi-menu-right');
            }else{
                $('.pid-'+id).show();
                $(this).attr("state","on")
                $(this).removeClass('mdi-menu-right').addClass('mdi-menu-down');
            }
        })
    </script>
@endsection
